package com.smh.demo1.a08;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @author shiminghui
 * @date 2025/4/12 13:14
 * @description: TODO
 */
@Configuration
public class Config {

    @Bean
    @Scope("application") //不同的web应用程序对应不同的application
    public BeanForApplication beanForApplication() {
        return new BeanForApplication();
    }

    @Bean
    @Scope("session") // 不同的浏览器对应的不同的session
    public BeanForSession beanForSession() {
        return new BeanForSession();
    }

    @Bean
    @Scope("request") // 不同的请求对应的不同的request
    public BeanForRequest beanForRequest() {
        return new BeanForRequest();
    }

}
